import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('@/views/Layout'),
    children: [
      {
        path: '/',
        name: 'Home',
        component: () => import(/* webpackChunkName: "home" */'@/views/Home'),
        meta: { isKeepAlive: true }
      },
      {
        path: '/question',
        name: 'Question',
        component: () => import(/* webpackChunkName: "question" */'@/views/Question')
      },
      {
        path: '/user',
        name: 'User',
        component: () => import(/* webpackChunkName: "user" */'@/views/User')
      },
      {
        path: '/video',
        name: 'Video',
        component: () => import(/* webpackChunkName: "video" */'@/views/Video')
      }
    ]
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import(/* webpackChunkName: "search" */'@/views/Search')
  },
  {
    path: '/article/:id',
    name: 'Article',
    component: () => import(/* webpackChunkName: "article" */'@/views/Article')
  },
  {
    path: '/search/result',
    name: 'SearchResult',
    component: () => import(/* webpackChunkName: "searchResult" */'@/views/Search/result')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "login" */'@/views/Login')
  },
  {
    path: '/user/profile',
    name: 'UserProfile',
    component: () => import(/* webpackChunkName: "userProfile" */'@/views/User/profile.vue')
  },
  {
    path: '/user/chat',
    name: 'UserChat',
    component: () => import(/* webpackChunkName: "userChat" */'@/views/User/chat.vue')
  }
]

const router = new VueRouter({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router
